package com.wdl.networkflow.topN

import org.apache.flink.streaming.api.scala.function.WindowFunction
import org.apache.flink.streaming.api.windowing.windows.TimeWindow
import org.apache.flink.util.Collector

class PageCountWindowResult() extends WindowFunction[Long, PageViewCount, String, TimeWindow]{
  override def apply(key: String,
                     window: TimeWindow,
                     input: Iterable[Long],
                     out: Collector[PageViewCount]): Unit = {
    val windowEnd: Long = window.getEnd
    out.collect(PageViewCount(key, windowEnd, input.head))
  }
}
